/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pt.utl.ist.isr.livetrack.server.impl;

import pt.utl.ist.isr.livetrack.server.interfaces.Blob;
import java.io.Serializable;
import org.apache.log4j.Logger;

/**
 *
 * @author David Miguel Antunes <davidmiguel [ at ] antunes.net>
 */
public class BlobImpl implements Blob, Serializable {

    private static final Logger logger = Logger.getLogger(BlobImpl.class);
    private int topLeftX, topLeftY, bottomRightX, bottomRightY;
    private int size;
    private String camId;

    public BlobImpl(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY, int size, String camId) {
        this.topLeftX = topLeftX;
        this.topLeftY = topLeftY;
        this.bottomRightX = bottomRightX;
        this.bottomRightY = bottomRightY;
        this.size = size;
        this.camId = camId;
    }

    @Override
    public int getSize() {
        return size;
    }

    @Override
    public int getTopLeftX() {
        return topLeftX;
    }

    @Override
    public int getTopLeftY() {
        return topLeftY;
    }

    @Override
    public int getBottomRightX() {
        return bottomRightX;
    }

    @Override
    public int getBottomRightY() {
        return bottomRightY;
    }

    @Override
    public int getArea() {
        return (bottomRightX - topLeftX) * (bottomRightY - topLeftY);
    }

    @Override
    public String getCameraId() {
        return camId;
    }

    @Override
    public String toString() {
        return "BlobImpl{" + "tlx=" + topLeftX + ", tly=" + topLeftY + ", brx=" + bottomRightX + ", bry=" + bottomRightY + ", size=" + size + ", area=" + (bottomRightX - topLeftX) * (bottomRightY - topLeftY) + '}';
    }
}
